package com.xce.business.controller;

import com.xce.business.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName BusinessController
 * @Description TODO
 * @Author lld
 * @Date 2025/7/10 1:03
 * @Version 1.0
 */
@RestController
public class BusinessController {

    @Autowired
    private BusinessService businessService;

    /**
     * 购买
     * @param userId 用户ID
     * @param commodityCode 商品编码
     * @param orderCount 购买数量
     */
    @GetMapping("/purchase")
    public String purchase(@RequestParam("userId") String userId,
                         @RequestParam("commodityCode") String commodityCode,
                         @RequestParam("orderCount") int orderCount) {
        businessService.purchase(userId, commodityCode, orderCount);

        return "business purchase success";
    }
}
